#include "nodeelement.h"
/*
NodeElement::NodeElement()
	: DiagramElement()
{

}
*/
NodeElement::~NodeElement()
{

}


QRectF NodeElement::boundingRect() const
{
	return QRectF(-15, -15, 30, 30);
}

QPainterPath NodeElement::shape() const
{
	QPainterPath path;
	path.addEllipse(boundingRect());
	return path;
}

QPointF NodeElement::intersectionPoint(QLineF &line)
{
	qreal angle = (180.0 - line.angle())  * 3.14 / 180.0;
	qreal radius = boundingRect().width() / 2.0;
	return line.p2() + QPointF(radius * qCos(angle), radius * qSin(angle));
}